﻿namespace dPet.Domain.Specifications
{
	using dPet.Domain.Models;
	using Hangerd.Specification;

	public class ProductSpecifications
	{
		public static Specification<Product> IdEquals(string id)
		{
			return new DirectSpecification<Product>(p => p.Id == id);
		}

		public static Specification<Product> HospitalIdEquals(string hospitalId)
		{
			return new DirectSpecification<Product>(p => p.HospitalId == hospitalId);
		}

		public static Specification<Product> BarcodeEquals(string barcode)
		{
			return new DirectSpecification<Product>(p => !string.IsNullOrEmpty(p.Barcode) && p.Barcode == barcode);
		}

		public static Specification<Product> QueryTagEquals(string queryTag) 
		{
			return new DirectSpecification<Product>(p => !string.IsNullOrEmpty(p.QueryTag) && p.QueryTag == queryTag);
		}
		public static Specification<Product> NameContains(string name)
		{
			return new DirectSpecification<Product>(p => p.Name.Contains(name));
		}

		public static Specification<Product> EnableQuantityAlarm()
		{
			return new DirectSpecification<Product>(p => p.EnableQuantityAlarm);
		}

		public static Specification<Product> EnableExpiryAlarm()
		{
			return new DirectSpecification<Product>(p => p.EnableExpiryAlarm);
		}
	}
}
